<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:composite="http://java.sun.com/jsf/composite">
    
  <!-- INTERFACE -->
  <composite:interface>
  	<composite:attribute name="listener" method-signature="void listener(org.richfaces.event.FileUploadEvent)" required="true"/>  
  	<composite:attribute name="render"/>
  </composite:interface>

  <!-- IMPLEMENTATION -->          
    <composite:implementation>
    	<h:panelGrid columns="2" cellpadding="0" cellspacing="0">
          		<rich:fileUpload maxFilesQuantity="1" listHeight="0" fileUploadListener="#{cc.attrs.listener}" addLabel="Browse" noDuplicate="true" 
          		acceptedTypes="jpg, gif, png, bmp" ontyperejected="alert('Only JPG, GIF, PNG and BMP files are accepted');">
          		<a4j:ajax event="uploadcomplete" execute="@none" render="#{cc.attrs.render}" />
          </rich:fileUpload>
          </h:panelGrid>
  	</composite:implementation>
</html>  